# coding=utf-8
import sys
import utility
import config
reload(sys)
sys.setdefaultencoding('utf-8')
import xmlrpclib
import MySQLdb
import json
from LightMysql import LightMysql

common = xmlrpclib.ServerProxy('{}/xmlrpc/2/common'.format(config.url))
common.version()
uid = common.authenticate(config.odooDb, config.username, config.password, {})
models = xmlrpclib.ServerProxy('{}/xmlrpc/2/object'.format(config.url))
dbconfig = {'host':'123.57.159.46','port': 3306,'user':'manager','passwd':'39865897','db':'ws','charset':'utf8'}
db = LightMysql(dbconfig)





def createSales():
    res=models.execute_kw(config.odooDb, uid, config.password, 'sale.order', 'create', [{
        'partner_id':19,
        'order_line':[(0,0,{
            'product_id':5366,
            'product_uom_qty':2.0,
            'price_unit':3.2,
            'name':'分销商城-自动下单',
            'product_uom':1,
            'tax_id':[(6,0,[3])]
        })]
    }])
    # print res
    #print models.execute_kw(config.odooDb, uid, config.password,'sale.order','action_confirm',[res])



createSales()



































#
